<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

    <input type="text" id="username">

    <script>
        var username = document.getElementById("username");
        username.onkeyup=function(e){
            console.log(e.target.value);
        }

    </script>
</body>
</html>